#pragma once
#include "gtest/gtest.h"

#include "Utility/FileSystem/SGFileSystem.h"

// compareTextFile 测试内容相同的两个文件
TEST (compareTextFileTest, sameContent)
{
    // Input Data
    auto fileTest   = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/sameContentFileTest.txt");
    auto fileTarget = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/fileTarget.txt");

    // Test
    const bool isTrue = SG::Utility::FileSystem::compareTextFile (fileTarget, fileTest);

    // Check
    ASSERT_TRUE (isTrue);
}

// compareTextFile 测试内容不同的两个文件
TEST (compareTextFileTest, differentContent)
{
    // Input Data
    auto fileTest   = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/differentContentFileTest.txt");
    auto fileTarget = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/fileTarget.txt");

    // Test
    bool isFalse = SG::Utility::FileSystem::compareTextFile (fileTarget, fileTest);

    // Check
    ASSERT_TRUE (!isFalse);
}

//  测试内容相同的两个文件
TEST (compareVTK, SameRight)
{
    // Input Data
    auto fileTest   = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/TargetSameRight.vtk");
    auto fileTarget = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/Target.vtk");

    // Test
    bool isFalse = SG::Utility::FileSystem::compareVTK (fileTarget, fileTest);

    // Check
    ASSERT_TRUE (isFalse);
}

//  测试内容不同的两个文件
TEST (compareVTK, DifferentRight)
{
    // Input Data
    auto fileTest   = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/TargetDifferentRight.vtk");
    auto fileTarget = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/Target.vtk");

    // Test
    bool isFalse = SG::Utility::FileSystem::compareVTK (fileTarget, fileTest);

    // Check
    ASSERT_TRUE (isFalse);
}

TEST (compareVTK, DifferentWrong)
{
    // Input Data
    auto fileTest   = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/TargetDifferentWrong.vtk");
    auto fileTarget = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/Target.vtk");

    // Testssss
    bool isTrue = SG::Utility::FileSystem::compareVTK (fileTarget, fileTest);

    // Check
    ASSERT_FALSE (isTrue);
}

TEST (compareVTK, DifferentXuxihaoGive)
{
    // Input Data
    auto fileTest   = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/CBAR_NodeDofRelease_Static_Target.vtk");
    auto fileTarget = SG::Utility::FileSystem::getTestDataPath ("Infrastructure/BasicTools/CBAR_NodeDofRelease.vtk");

    // Testssss
    bool isTrue = SG::Utility::FileSystem::compareVTK (fileTarget, fileTest);

    // Check
    ASSERT_TRUE (isTrue);
}
